package com.douyin.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("api_log")
public class ApiLog implements Serializable {
    public ApiLog(String method, String path,String requestBody, int status, String responseBody, long duration) {
        this.duration = duration;
        this.method = method;
        this.path = path;
        this.status = status;
        this.requestBody = requestBody;
        this.responseBody = responseBody;
    }

    private String method;
    private String path;
    private String requestBody;
    private int status;
    private String responseBody;
    private long duration;
    private String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss"));
}
